package com.li.springbootproject.controller.thread;

import com.li.springbootproject.service.thread.ThreadTestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description：
 * @Author：LiDong
 * @Create：2021/3/17
 * @Version：1.0.0
 */
@RestController
@RequestMapping("/thread")
public class ThreadTestController {

    @Autowired
    private ThreadTestService threadTestService;

    @RequestMapping("/sychnoized")
    public int sychnoizedTest(){
        return threadTestService.sychnoizedTest();
    }

    @RequestMapping("/globalexecutor")
    public void globalExecutorTest(){
         threadTestService.globalExecutorTest();
    }

    /**
     * 模拟栈溢出
     */
    @RequestMapping("/test1")
    public void test1() {
        threadTestService.testOne();
    }

    /**
     * 模拟堆溢出
     */
    @RequestMapping("/test2")
    public void test2() {
        threadTestService.testTwo();
    }

    /**
     * arthas 测试
     */
    @RequestMapping("/test3")
    public void test3(){
        threadTestService.testThree();
    }
}
